home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2001 / MacHack 2001.toast / pc / The Hacks / The Weakest Link / source / OpenTptEnet / CIncludes / DlpiLib.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-06-23  |  4.9 KB  |  153 lines

  1. /*
  2.     File:        DlpiLib.h
  3.  
  4.     Contains:    Defines for the DLPI library
  5.  
  6.     Version:    1.0.0
  7.  
  8.     Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11.  
  12. #ifndef _DLPILIB_H_
  13. #define _DLPILIB_H_
  14.  
  15. #include "EnetUser.h"
  16.  
  17. #define kMaxEnetPort            10
  18. typedef UInt8                    EnetAddr[6];
  19. typedef UInt8 *                    EnetAddrPtr;
  20. typedef char                    EnetPortName[256];
  21. typedef char *                    EnetPortNamePtr;
  22. typedef char                    EnetPortSlot[256];
  23. typedef char *                    EnetPortSlotPtr;
  24.  
  25. extern FILE *gLPrintfFile;
  26.  
  27. // LPrintf() does an fprintf() to the global log file.
  28. // It does nothing if gLPrintfFile is NULL.
  29. extern int LPrintf(const char *format, ...);
  30.  
  31. // StringToEnetAddr() converts a printable string to an ethernet address.
  32. // The format is 01:02:03:04:05, the six bytes in hex.
  33. // Returns false if there was an error.
  34. extern Boolean StringToEnetAddr(char *buffer, EnetAddrPtr addr);
  35.  
  36. // EnetAddrToString() converts an ethernet address to a printable string.
  37. // The format is 01:02:03:04:05, the six bytes in hex.
  38. // Returns a pointer to a single static string buffer.
  39. extern char *EnetAddrToString(EnetAddressPtr addr);
  40.  
  41. extern char *dl_mac_type_to_string(UInt32 dl_mac_type);
  42.  
  43. extern char *dl_state_to_string(UInt32 dl_current_state);
  44.  
  45. extern char *dl_service_mode_to_string(UInt32 dl_service_mode);
  46.  
  47. extern char *dl_provider_style_to_string(UInt32 dl_provider_style);
  48.  
  49. extern char *dl_error_to_string(dl_error_ack_t *errorAck);
  50.  
  51. // dl_set_phys_addr_req() does a DL_SET_PHYS_ADDR_REQ.
  52. // Returns false if there was an error.
  53. extern Boolean dl_set_phys_addr_req(int stream, EnetAddrPtr address);
  54.  
  55. // dl_phys_addr_req() does a DL_PHYS_ADDR_REQ.
  56. // Returns false if there was an error.
  57. extern Boolean dl_phys_addr_req(int stream, int addrType, EnetAddressPtr address);
  58.  
  59. extern Boolean
  60.     dl_get_statistics_req(int stream,
  61.                           dl_get_statistics_ack_t *getStatisticsAck,
  62.                           dle_interface_status_t **iStatus,
  63.                           dle_ethernet_status_t **eStatus);
  64.  
  65. extern Boolean
  66.     dl_info_req(int stream,
  67.                 dl_info_ack_t *infoAck,
  68.                 EnetAddrPtr *unicast,
  69.                 EnetAddrPtr *broadcast);
  70.  
  71. extern Boolean dl_detach_req(int stream);
  72.  
  73. extern Boolean dl_attach_req(int stream, int ppa);
  74.  
  75. // dl_bind_req() does a DL_BIND_REQ.
  76. // The stream is bound to the specified protocol SAP.
  77. // Returns false if there was an error.
  78. extern Boolean dl_bind_req(int stream, UInt16 sap);
  79.  
  80. // dl_unitdata_req() does a DL_UNITDATA_REQ.
  81. // This is the basic transmit operation.
  82. // Returns false if there was an error.
  83. extern Boolean
  84.     dl_unitdata_req(int stream, void *buffer, UInt32 size, UInt8 *dest);
  85.  
  86. // dl_unitdata_ind() handles a DL_UNITDATA_IND.
  87. // This is the basic receive operation.
  88. // This function blocks until a packet has been received.
  89. // Returns false if there was an error.
  90. extern Boolean
  91.     dl_unitdata_ind(int stream,
  92.                     UInt32 maxPacketSize,
  93.                     char *packet,
  94.                     UInt32 *packetSize,
  95.                     EnetAddressPtr address,
  96.                     UInt16 proto,
  97.                     UInt32 timeoutMilliseconds);
  98.  
  99. // dl_enabmulti_req() does a DL_ENABMULTI_REQ.
  100. // The stream will receive packets to the specified multicast address.
  101. // Returns false if there was an error.
  102. extern Boolean dl_enabmulti_req(int stream, UInt8 *address);
  103.  
  104. // dl_disabmulti_req() does a DL_DISABMULTI_REQ.
  105. // The stream will receive packets to the specified multicast address.
  106. // Returns false if there was an error.
  107. extern Boolean dl_disabmulti_req(int stream, UInt8 *address);
  108.  
  109. extern Boolean dl_promiscon_req(int stream, UInt32 level);
  110.  
  111. extern Boolean dl_promiscoff_req(int stream, UInt32 level);
  112.  
  113. extern Boolean ioctl_EnetShim(int stream, ENETShimRequest *enetShimRequest);
  114.  
  115. extern Boolean ioctl_VirtualController(int stream, VCRequest *vcRequest);
  116.  
  117. extern Boolean ioctl_FastPath(int stream, dl_unitdata_req_t *unitdata_req);
  118.  
  119. extern Boolean ioctl_SetFramingType(int stream, UInt32 *framingType);
  120.  
  121. extern Boolean ioctl_SetRawMode(int stream, void *rawModeReq);
  122.  
  123. extern Boolean ioctl_EnetLog(int stream, char buffer[kMaxEnetStatus]);
  124.  
  125. extern Boolean ioctl_EnetStatus(int stream, char buffer[kMaxEnetStatus]);
  126.  
  127. extern Boolean ioctl_EnetTest(int stream, char buffer[kMaxEnetStatus]);
  128.  
  129. extern Boolean ioctl_EnetReset(int stream, char buffer[kMaxEnetStatus]);
  130.  
  131. extern Boolean ioctl_DlpiTest(int stream, UInt32 code);
  132.  
  133. // GetEnetAddress gets the ethernet address for the specified Enet Port.
  134. // Returns false if there was an error.
  135. extern Boolean
  136.     GetEnetAddress(EnetPortNamePtr enetPortName, EnetAddressPtr address);
  137.  
  138. // GetEnetPortInfo gets the Nth Enet Port name.
  139. // The index is a positive integer starting at zero.
  140. // Returns false if there was an error.
  141. extern Boolean
  142.     GetEnetPortInfo(int n,
  143.                     EnetPortNamePtr enetPortName,
  144.                     EnetPortSlotPtr enetPortSlot,
  145.                     EnetAddrPtr address);
  146.  
  147. #include <stropts.h>
  148.  
  149. #include <DriverServices.h>
  150.  
  151. extern void OTSetServerMode(void);
  152.  
  153. #endif // _DLPILIB_H_